<!--#include file="./top.asp"-->

<%
	dim rs_replace_word, str_replace_word, name_subject, new_comment, count_comment
	
	'name_subject = "rpt_mandarin"

	array_old = Array("P1","P2","P3","P4","P5","Year 1","Year 2","Year 3","Year 4","Year 5","Grade One","Grade Two","Grade Three","Grade Four",	"Grade Five","Year One","Year Two","Year Three","Year Four","Year Five")
	array_new = Array("Primary One","Primary Two","Primary Three","Primary Four","Primary Five","Primary One","Primary Two","Primary Three","Primary Four","Primary Five","Primary One","Primary Two","Primary Three","Primary Four","Primary Five","Primary One","Primary Two","Primary Three","Primary Four","Primary Five")
	
	Sub replace_word_comment(name_subject)

		set rs_replace_word = server.CreateObject("Adodb.Recordset")
		str_replace_word = "select * from "& name_subject
		rs_replace_word.open str_replace_word, conn, 1, 3

		count_comment = rs_replace_word.fields.count - 1
		
		do while not rs_replace_word.eof
			If IsNull(rs_replace_word.fields(count_comment)) Then 
				rs_replace_word.movenext
				If rs_replace_word.eof Then
					Exit Do 
				End if
			End If
			
			For i = 1 to 20
				rs_replace_word.fields(count_comment) = replace(rs_replace_word.fields(count_comment), array_old(i-1), array_new(i-1))
			next
			'rs_replace_word.fields(count_comment) = replace(rs_replace_word.fields(count_comment), old_word, new_word)
			'rs_replace_word.fields(count_comment) = replace(rs_replace_word.fields(count_comment), "primaryone", "Primary One")
			response.write rs_replace_word.fields(count_comment) & "<br />"
			
			'rs_replace_word.update
			rs_replace_word.movenext
		Loop
		
		rs_replace_word.close
		Set rs_replace_word = nothing
	End Sub

	Call replace_word("rpt_")

%>
</body>
</html>
<%
		'rs_replace_word.close
		'set rs_replace_word = nothing
		'conn.close
		'set conn = nothing
%>



